GBML manual / Backgrounds

One picture, several palettes

A background picture or a tileset drawn with up to 16 palettes of 16 colors - each 8x8 tile wears one of them - for a title screen, a backdrop or a painted room that needs more than 16 colors.

When 16 colors are not enough

A background picture normally has one palette of 16 colors, and color 0 is see-through, so 15 you can see. That is plenty for a floor or a wall and too little for a title screen, a painted sky or a picture in a cutscene.

The console has a way around it, and the games that look richest on it use it: a background can be drawn with several palettes at once, and every 8x8 tile of the picture picks one. A picture drawn with four palettes can use 60 different colors, one with sixteen palettes up to 240, and no tile is ever asked to use more than its own 16.

The rule: one palette to a tile

Inside such a picture, color numbers count on from one palette to the next:

Color numbersPalette
0 - 15palette 0
16 - 31palette 1
32 - 47palette 2
......
240 - 255palette 15

The first color of every palette (0, 16, 32 ...) is see-through, as it is in an ordinary picture.

Every 8x8 tile may use colors of only one palette. That is how the hardware works: a tile is told which palette it wears and cannot mix two. A picture where a tile does break the rule is refused when you build the game, and the message names the picture and the tile (its position in pixels from the picture's top-left corner) so you can find it in the Paint tab.

Making one

In the Paint tab, Create palette from reference can split a picture into several palettes for you, tile by tile, and save the result as a picture you can use right away. Nothing else changes about using it: a room's whole picture, a background made with background_create, and a picture shown by a cutscene's Show Picture step all take it like any other picture, and the room editor and the cutscene preview draw it in its real colors.

What it costs

Every palette of the picture takes one of the console's 16 background palettes, side by side, for as long as the picture is alive (hidden does not free them; destroying it or leaving the room does). A picture with four palettes takes four.

The Budgets panel's BG palettes (room) gauge counts every palette of such a picture.

Fades, palette swaps and a room's Room Palette

A tileset with several palettes

A tileset - the sheet of tiles you paint a room with in the Room editor - can be drawn with several palettes the same way. Every tile of the tileset (each 8x8 square of the sheet) wears one palette, and the room remembers it: paint a tile and the painted square is drawn in that tile's palette, with no extra step. Flip a painted tile and it keeps its palette.

See also: BackgroundsPalettes - recoloring a pictureBudgetsbackground_createbackground_palettetile_layer_palettetile_set_indexTile animationZoomable backgrounds